/*************************************************************************
	> File Name: 11.HZOJ-363.cpp
	> Author: hug
	> Mail: hug@haizeix.com
	> Created Time: 五  2/14 16:06:43 2025
 ************************************************************************/

#include <iostream>
#include <cstring>
using namespace std;

struct Edge {
    int to, nxt;
} e[3005];
int head[1505], cnt = 0;
void add(int a, int b) {
    e[++cnt] = {b, head[a]};
    head[a] = cnt;
    return ;
}

int n;
int dp[1505][3];

void init() {
    cnt = 0;
    memset(head, 0, sizeof(head));
    return ;
}

void getDP(int fa, int ind) {
    dp[ind][0] = 1;
    dp[ind][1] = 0;
    dp[ind][2] = 0;
    int f1 = 1;
    for (int p = head[ind]; p; p = e[p].nxt) {
        int to = e[p].to;
        if (to == fa) continue;
        getDP(ind, to);
        dp[ind][0] += dp[to][2]; 
        dp[ind][1] += dp[to][1];
        if (dp[to][1] == dp[to][0]) f1 = 0;
        dp[ind][2] += dp[to][1];
    }
    dp[ind][1] += f1;
    dp[ind][1] = min(dp[ind][0], dp[ind][1]);
    dp[ind][2] = min(dp[ind][1], dp[ind][2]);
    return ;
}

bool solve() {
    init();
    if (scanf("%d", &n) == EOF) return false;
    for (int i = 0; i < n; i++) {
        int x, k;
        scanf("%d:(%d)", &x, &k);
        for (int j = 0, y; j < k; j++) {
            scanf("%d", &y);
            add(x, y);
            add(y, x);
        }
    }
    getDP(-1, 0);
    cout << dp[0][1] << endl;
    return true;
}

int main() {
    while (solve()) ;
    return 0;
}
